package apiday03.homework;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortPoint {
    public static void main(String[] args) {
        List<Point> list = new ArrayList<>();
        list.add(new Point(3,5));
        list.add(new Point(5,3));
        list.add(new Point(8,15));
        list.add(new Point(10,16));
        list.add(new Point(2,19));
        System.out.println(list);
        Collections.sort(list,(o1,o2)-> o1.getY()- o2.getY());
        System.out.println(list);
        Collections.sort(list, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return o2.getX()- o1.getX();
            }
        });
        System.out.println(list);
    }
}
